package com.telecomyt.jwportal.activity.behavior;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.telecomyt.jwportal.R;
import com.telecomyt.jwportal.base.BaseActivity;
import com.telecomyt.jwportal.base.BasePresenter;
import com.yinglan.scrolllayout.ScrollLayout;
import com.yinglan.scrolllayout.content.ContentScrollView;

import butterknife.BindView;

public class BehaviorActivity extends BaseActivity {


    @BindView(R.id.id_main_map)
    View idMainMap;
    @BindView(R.id.id_main_skip)
    ImageView idMainSkip;
    @BindView(R.id.id_rout_total)
    TextView idRoutTotal;
    @BindView(R.id.id_rout_normal)
    TextView idRoutNormal;
    @BindView(R.id.id_rout_wrong)
    TextView idRoutWrong;
    @BindView(R.id.id_rout_percent)
    TextView idRoutPercent;
    @BindView(R.id.id_ll_open)
    LinearLayout idLlOpen;
    @BindView(R.id.id_rush_total)
    TextView idRushTotal;
    @BindView(R.id.id_rush_normal)
    TextView idRushNormal;
    @BindView(R.id.id_rush_wrong)
    TextView idRushWrong;
    @BindView(R.id.id_rush_percent)
    TextView idRushPercent;
    @BindView(R.id.id_test_total)
    TextView idTestTotal;
    @BindView(R.id.id_test_nomal)
    TextView idTestNomal;
    @BindView(R.id.id_test_wrong)
    TextView idTestWrong;
    @BindView(R.id.id_test_percent)
    TextView idTestPercent;
    @BindView(R.id.id_repair_total)
    TextView idRepairTotal;
    @BindView(R.id.id_repair_normal)
    TextView idRepairNormal;
    @BindView(R.id.id_repair_wrong)
    TextView idRepairWrong;
    @BindView(R.id.id_repair_percent)
    TextView idRepairPercent;
    @BindView(R.id.content_scroll_layout)
    ContentScrollView contentScrollLayout;
    @BindView(R.id.scroll_down_layout)
    ScrollLayout scrollDownLayout;

    public static void start(Context context) {
        Intent starter = new Intent(context, BehaviorActivity.class);
        context.startActivity(starter);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_behavior;
    }

    @Override
    protected void initView() {
        scrollDownLayout.setOnScrollChangedListener(mOnScrollChangedListener);
        scrollDownLayout.getBackground().setAlpha(0);
        scrollDownLayout.setExitOffset(280);
    }

    @Override
    protected void initData() {

    }

    private ScrollLayout.OnScrollChangedListener mOnScrollChangedListener = new ScrollLayout.OnScrollChangedListener() {
        @Override
        public void onScrollProgressChanged(float currentProgress) {
            if (currentProgress >= 0) {
                float precent = 280 * currentProgress;
                if (precent > 280) {
                    precent = 280;
                } else if (precent < 0) {
                    precent = 0;
                }
                scrollDownLayout.getBackground().setAlpha(255 - (int) precent);
            }
        }

        @Override
        public void onScrollFinished(ScrollLayout.Status currentStatus) {
            if (currentStatus.equals(ScrollLayout.Status.EXIT)) {
                //finish();
            }
        }

        @Override
        public void onChildScroll(int top) {
        }
    };

    @Override
    protected BasePresenter creatPresenter() {
        return null;
    }
}

